package com.tedu.charging.common.pojo.web;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ServerResult<T>  implements Serializable {
   public static final long serialVersionUID=1L;
   private  int code;
   private  String msg;
   private  T data;
   public ServerResult(int code,String msg){
      this.code=code;
      this.msg=msg;
   }
   public static ServerResult success()
   {

      return new ServerResult(0,"操作成功");
   }
   public static ServerResult success(String msg)
   {

      return new ServerResult(0,msg);
   }
   public static ServerResult success(Object data)
   {

      return new ServerResult(0,"操作成功",data);
   }
   public static ServerResult success(String msg,Object data)
   {

      return new ServerResult(0,msg,data);
   }
}
